/**
 * Copyright &copy; 2012-2017 <a href="https://vivo.com">vivo</a> All rights reserved.
 */
package com.vivo.dealer.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.vivo.dealer.entity.ViDealerInfo;
import com.vivo.dealer.dao.ViDealerInfoDao;

/**
 * 经销商信息Service
 * @author jyangye
 * @version 2017-11-26
 */
@Service
@Transactional(readOnly = true)
public class ViDealerInfoService extends CrudService<ViDealerInfoDao, ViDealerInfo> {

    @Autowired
    private ViDealerInfoDao viDealerInfoDao;

	public ViDealerInfo get(String id) {
		return super.get(id);
	}


	public ViDealerInfo get(ViDealerInfo viDealerInfo) {
		return super.get(viDealerInfo);
	}

	public ViDealerInfo getByDealerId(ViDealerInfo viDealerInfo) {
		return viDealerInfoDao.getByDealerId(viDealerInfo);
	}

	public List<ViDealerInfo> findList(ViDealerInfo viDealerInfo) {
		return super.findList(viDealerInfo);
	}
	
	public Page<ViDealerInfo> findPage(Page<ViDealerInfo> page, ViDealerInfo viDealerInfo) {
		return super.findPage(page, viDealerInfo);
	}

    @Transactional(readOnly = false)
	public void insertByBatch(List<ViDealerInfo> dealerList, String area) {
	    if (area.equals("ah")) {
	        viDealerInfoDao.insertByBatchAh(dealerList);
        } else {
	        viDealerInfoDao.insertByBatchJs(dealerList);
        }
    }

	
	@Transactional(readOnly = false)
	public void save(ViDealerInfo viDealerInfo) {
		super.save(viDealerInfo);
	}
	
	@Transactional(readOnly = false)
	public void delete(ViDealerInfo viDealerInfo) {
		super.delete(viDealerInfo);
	}


	@Transactional(readOnly = false)
	public void deleteAll(ViDealerInfo viDealerInfo) {
		viDealerInfoDao.deleteAll(viDealerInfo);
	}
	
}